import { createRouter, createWebHistory } from 'vue-router';
import Login from './view/login/login-page.vue';
import Register from './view/login/register-page.vue';
import ForgetPassword from './view/login/forgetPassword-page.vue';
import NotFound from './view/not-found/notFound-page.vue';
import ChatHome from './view/chat/chat-home.vue';
import ChatDefault from "./view/chat/chat-default.vue";
import ChatBox from "@/view/chat/chat-box.vue";
import Md from "@/view/md.vue";
const routes = [
    {
        path: '/',
        component: ChatHome, // 主页面
        name: 'chat-home',
        children: [
            {
                path: '', // 默认路径，当没有子路由时显示 DefaultPage
                name: 'chat-default',
                component: ChatDefault, // 默认页面
            },
            {
                path: 'chat/:historyRecordId', // 动态路径，根据 chatId 显示聊天内容
                name: 'chat-box',
                component: ChatBox,
                props: true, // 启用路由参数传递
            }
        ]
    },
    {
        path: '/md',
        component:Md,

    },

    { path: '/login', component: Login, name: 'login' },
    { path: '/register', component: Register, name: 'register' },
    { path: '/forget-password', component: ForgetPassword, name: 'forgetPassword' },

    // 404 页面
    { path: '/:pathMatch(.*)*', component: NotFound ,name: "notFound-404" },
];

const router = createRouter({
    history: createWebHistory(),
    routes
});

export default router;
